<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>octant.seawater</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="octant-module.html">Package&nbsp;octant</a> ::
        Module&nbsp;seawater
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="octant.seawater-module.html">Module octant.seawater</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-comment"># encoding: utf-8</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-docstring">"""Tools for working with seawater data."""</tt> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-name">__docformat__</tt> <tt class="py-op">=</tt> <tt class="py-string">"restructuredtext en"</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt>  <tt class="py-line"> </tt>
<a name="L5"></a><tt class="py-lineno"> 5</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">numpy</tt> <tt class="py-keyword">as</tt> <tt class="py-name">np</tt> </tt>
<a name="L6"></a><tt class="py-lineno"> 6</tt>  <tt class="py-line"> </tt>
<a name="psu2reference_salinity"></a><div id="psu2reference_salinity-def"><a name="L7"></a><tt class="py-lineno"> 7</tt> <a class="py-toggle" href="#" id="psu2reference_salinity-toggle" onclick="return toggle('psu2reference_salinity');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.seawater-module.html#psu2reference_salinity">psu2reference_salinity</a><tt class="py-op">(</tt><tt class="py-param">psu</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="psu2reference_salinity-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="psu2reference_salinity-expanded"><a name="L8"></a><tt class="py-lineno"> 8</tt>  <tt class="py-line">    <tt class="py-docstring">'''Return reference salinity given practical salinity</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L10"></a><tt class="py-lineno">10</tt>  <tt class="py-line"><tt class="py-docstring">        Fundamental determinations of the physical properties of seawater have</tt> </tt>
<a name="L11"></a><tt class="py-lineno">11</tt>  <tt class="py-line"><tt class="py-docstring">        previously been made for Atlantic surface waters, referred to as</tt> </tt>
<a name="L12"></a><tt class="py-lineno">12</tt>  <tt class="py-line"><tt class="py-docstring">        &#8220;Standard Seawater&#8221;. In this paper a Reference Composition consisting</tt> </tt>
<a name="L13"></a><tt class="py-lineno">13</tt>  <tt class="py-line"><tt class="py-docstring">        of the major components of Atlantic surface seawater is determined</tt> </tt>
<a name="L14"></a><tt class="py-lineno">14</tt>  <tt class="py-line"><tt class="py-docstring">        using these earlier analytical measurements. The stoichiometry of sea</tt> </tt>
<a name="L15"></a><tt class="py-lineno">15</tt>  <tt class="py-line"><tt class="py-docstring">        salt introduced here is thus based on the most accurate prior</tt> </tt>
<a name="L16"></a><tt class="py-lineno">16</tt>  <tt class="py-line"><tt class="py-docstring">        determination of the composition, adjusted to achieve charge balance</tt> </tt>
<a name="L17"></a><tt class="py-lineno">17</tt>  <tt class="py-line"><tt class="py-docstring">        and making use of the 2005 atomic weights. Reference Seawater is</tt> </tt>
<a name="L18"></a><tt class="py-lineno">18</tt>  <tt class="py-line"><tt class="py-docstring">        defined as any seawater that has the Reference Composition and a new</tt> </tt>
<a name="L19"></a><tt class="py-lineno">19</tt>  <tt class="py-line"><tt class="py-docstring">        Reference-Composition Salinity SR is defined to provide the best</tt> </tt>
<a name="L20"></a><tt class="py-lineno">20</tt>  <tt class="py-line"><tt class="py-docstring">        available estimate of the Absolute Salinity of both Reference Seawater</tt> </tt>
<a name="L21"></a><tt class="py-lineno">21</tt>  <tt class="py-line"><tt class="py-docstring">        and the Standard Seawater that was used in the measurements of the</tt> </tt>
<a name="L22"></a><tt class="py-lineno">22</tt>  <tt class="py-line"><tt class="py-docstring">        physical properties. From a p ractical point of view, the value of SR</tt> </tt>
<a name="L23"></a><tt class="py-lineno">23</tt>  <tt class="py-line"><tt class="py-docstring">        can be related to the Practical Salinity S by</tt> </tt>
<a name="L24"></a><tt class="py-lineno">24</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L25"></a><tt class="py-lineno">25</tt>  <tt class="py-line"><tt class="py-docstring">                SR = (35.165 04 / 35) g kg&#8211;1 &#215; S .</tt> </tt>
<a name="L26"></a><tt class="py-lineno">26</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L27"></a><tt class="py-lineno">27</tt>  <tt class="py-line"><tt class="py-docstring">        Reference Seawater that has been &#8220;normalized&#8221; to a Practical Salinity</tt> </tt>
<a name="L28"></a><tt class="py-lineno">28</tt>  <tt class="py-line"><tt class="py-docstring">         of 35 has a Reference-Composition Salinity of exactly</tt> </tt>
<a name="L29"></a><tt class="py-lineno">29</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L30"></a><tt class="py-lineno">30</tt>  <tt class="py-line"><tt class="py-docstring">                SR = 35.165 04 g kg&#8211;1.</tt> </tt>
<a name="L31"></a><tt class="py-lineno">31</tt>  <tt class="py-line"><tt class="py-docstring">                    </tt> </tt>
<a name="L32"></a><tt class="py-lineno">32</tt>  <tt class="py-line"><tt class="py-docstring">            Millero, F. J., R. Feistel, D. G. Wright and T. J. McDougall,</tt> </tt>
<a name="L33"></a><tt class="py-lineno">33</tt>  <tt class="py-line"><tt class="py-docstring">            2008a: The composition of Standard Seawater and the definition of</tt> </tt>
<a name="L34"></a><tt class="py-lineno">34</tt>  <tt class="py-line"><tt class="py-docstring">            the Reference-Composition Salinity Scale. Deep- Sea Research I,</tt> </tt>
<a name="L35"></a><tt class="py-lineno">35</tt>  <tt class="py-line"><tt class="py-docstring">            55, 50-72.</tt> </tt>
<a name="L36"></a><tt class="py-lineno">36</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L37"></a><tt class="py-lineno">37</tt>  <tt class="py-line"><tt class="py-docstring">    '''</tt> </tt>
<a name="L38"></a><tt class="py-lineno">38</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">psu</tt> <tt class="py-op">*</tt> <tt class="py-op">(</tt><tt class="py-number">35.16504</tt> <tt class="py-op">/</tt> <tt class="py-number">35.0</tt><tt class="py-op">)</tt> </tt>
</div><a name="L39"></a><tt class="py-lineno">39</tt>  <tt class="py-line"> </tt>
<a name="L40"></a><tt class="py-lineno">40</tt>  <tt class="py-line"> </tt>
<a name="o2_saturation"></a><div id="o2_saturation-def"><a name="L41"></a><tt class="py-lineno">41</tt> <a class="py-toggle" href="#" id="o2_saturation-toggle" onclick="return toggle('o2_saturation');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.seawater-module.html#o2_saturation">o2_saturation</a><tt class="py-op">(</tt><tt class="py-param">T</tt><tt class="py-op">,</tt><tt class="py-param">S</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="o2_saturation-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="o2_saturation-expanded"><a name="L42"></a><tt class="py-lineno">42</tt>  <tt class="py-line">    <tt class="py-docstring">"""Return saturation value of oxygen.</tt> </tt>
<a name="L43"></a><tt class="py-lineno">43</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L44"></a><tt class="py-lineno">44</tt>  <tt class="py-line"><tt class="py-docstring">    Parameters</tt> </tt>
<a name="L45"></a><tt class="py-lineno">45</tt>  <tt class="py-line"><tt class="py-docstring">    ----------</tt> </tt>
<a name="L46"></a><tt class="py-lineno">46</tt>  <tt class="py-line"><tt class="py-docstring">    T : array_like</tt> </tt>
<a name="L47"></a><tt class="py-lineno">47</tt>  <tt class="py-line"><tt class="py-docstring">        Temperature (&#730;C)</tt> </tt>
<a name="L48"></a><tt class="py-lineno">48</tt>  <tt class="py-line"><tt class="py-docstring">    S : array_like</tt> </tt>
<a name="L49"></a><tt class="py-lineno">49</tt>  <tt class="py-line"><tt class="py-docstring">        Salinity (PSU)</tt> </tt>
<a name="L50"></a><tt class="py-lineno">50</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L51"></a><tt class="py-lineno">51</tt>  <tt class="py-line"><tt class="py-docstring">    Returns</tt> </tt>
<a name="L52"></a><tt class="py-lineno">52</tt>  <tt class="py-line"><tt class="py-docstring">    -------</tt> </tt>
<a name="L53"></a><tt class="py-lineno">53</tt>  <tt class="py-line"><tt class="py-docstring">    o2_sat : array_like</tt> </tt>
<a name="L54"></a><tt class="py-lineno">54</tt>  <tt class="py-line"><tt class="py-docstring">        concentrations of o2 [ millimole O2 / m3 ] for a given temperature and</tt> </tt>
<a name="L55"></a><tt class="py-lineno">55</tt>  <tt class="py-line"><tt class="py-docstring">        salinity (at STP)</tt> </tt>
<a name="L56"></a><tt class="py-lineno">56</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L57"></a><tt class="py-lineno">57</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L58"></a><tt class="py-lineno">58</tt>  <tt class="py-line">    <tt class="py-name">A1</tt> <tt class="py-op">=</tt> <tt class="py-op">-</tt><tt class="py-number">173.4292</tt> </tt>
<a name="L59"></a><tt class="py-lineno">59</tt>  <tt class="py-line">    <tt class="py-name">A2</tt> <tt class="py-op">=</tt>  <tt class="py-number">249.6339</tt> </tt>
<a name="L60"></a><tt class="py-lineno">60</tt>  <tt class="py-line">    <tt class="py-name">A3</tt> <tt class="py-op">=</tt>  <tt class="py-number">143.3483</tt> </tt>
<a name="L61"></a><tt class="py-lineno">61</tt>  <tt class="py-line">    <tt class="py-name">A4</tt> <tt class="py-op">=</tt>  <tt class="py-op">-</tt><tt class="py-number">21.8492</tt> </tt>
<a name="L62"></a><tt class="py-lineno">62</tt>  <tt class="py-line">    <tt class="py-name">B1</tt> <tt class="py-op">=</tt>   <tt class="py-op">-</tt><tt class="py-number">0.033096</tt> </tt>
<a name="L63"></a><tt class="py-lineno">63</tt>  <tt class="py-line">    <tt class="py-name">B2</tt> <tt class="py-op">=</tt>    <tt class="py-number">0.014259</tt> </tt>
<a name="L64"></a><tt class="py-lineno">64</tt>  <tt class="py-line">    <tt class="py-name">B3</tt> <tt class="py-op">=</tt>   <tt class="py-op">-</tt><tt class="py-number">0.0017000</tt> </tt>
<a name="L65"></a><tt class="py-lineno">65</tt>  <tt class="py-line">    <tt class="py-comment"># Convert T to deg. C to deg. K</tt> </tt>
<a name="L66"></a><tt class="py-lineno">66</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">T</tt> <tt class="py-op">=</tt> <tt class="py-name">T</tt> <tt class="py-op">+</tt> <tt class="py-number">273.15</tt> </tt>
<a name="L67"></a><tt class="py-lineno">67</tt>  <tt class="py-line">    <tt class="py-comment"># O2 Concentration in mg/l</tt> </tt>
<a name="L68"></a><tt class="py-lineno">68</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-comment"># [from Millero and Sohn, Chemical Oceanography, CRC Press, 1992]</tt> </tt>
<a name="L69"></a><tt class="py-lineno">69</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">O</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Variable octant.ocean.depths.exp=octant.ocean.depths-module.html#exp,Variable octant.ocean.exp=octant.ocean-module.html#exp,Variable octant.ocean.state.exp=octant.ocean.state-module.html#exp,Variable octant.ocean.step3d_t.exp=octant.ocean.step3d_t-module.html#exp,Variable octant.ocean.time.exp=octant.ocean.time-module.html#exp,Variable octant.ocean.velocity.exp=octant.ocean.velocity-module.html#exp"><a title="octant.ocean.depths.exp
octant.ocean.exp
octant.ocean.state.exp
octant.ocean.step3d_t.exp
octant.ocean.time.exp
octant.ocean.velocity.exp" class="py-name" href="#" onclick="return doclink('link-0', 'exp', 'link-0');">exp</a></tt><tt class="py-op">(</tt><tt class="py-name">A1</tt> <tt class="py-op">+</tt> <tt class="py-name">A2</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-number">100.0</tt><tt class="py-op">/</tt><tt class="py-name">T</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">A3</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Variable octant.ocean.depths.log=octant.ocean.depths-module.html#log,Variable octant.ocean.log=octant.ocean-module.html#log,Variable octant.ocean.state.log=octant.ocean.state-module.html#log,Variable octant.ocean.step3d_t.log=octant.ocean.step3d_t-module.html#log,Variable octant.ocean.time.log=octant.ocean.time-module.html#log,Variable octant.ocean.velocity.log=octant.ocean.velocity-module.html#log"><a title="octant.ocean.depths.log
octant.ocean.log
octant.ocean.state.log
octant.ocean.step3d_t.log
octant.ocean.time.log
octant.ocean.velocity.log" class="py-name" href="#" onclick="return doclink('link-1', 'log', 'link-1');">log</a></tt><tt class="py-op">(</tt><tt class="py-name">T</tt><tt class="py-op">/</tt><tt class="py-number">100.0</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">A4</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">T</tt><tt class="py-op">/</tt><tt class="py-number">100.0</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> \ </tt>
<a name="L70"></a><tt class="py-lineno">70</tt>  <tt class="py-line">            <tt class="py-name">S</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">B1</tt> <tt class="py-op">+</tt> <tt class="py-name">B2</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">T</tt><tt class="py-op">/</tt><tt class="py-number">100.0</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">B3</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">T</tt><tt class="py-op">/</tt><tt class="py-number">100.0</tt><tt class="py-op">)</tt><tt class="py-op">**</tt><tt class="py-number">2</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">)</tt> </tt>
<a name="L71"></a><tt class="py-lineno">71</tt>  <tt class="py-line">    <tt class="py-comment"># Convert to mmol/m3</tt> </tt>
<a name="L72"></a><tt class="py-lineno">72</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-comment">#  mmol/m3 = 44.66 ml/l</tt> </tt>
<a name="L73"></a><tt class="py-lineno">73</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-comment">#  mg/l = ml/l * 1.42903 mg/ml</tt> </tt>
<a name="L74"></a><tt class="py-lineno">74</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-keyword">return</tt> <tt class="py-name">O</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-number">44.66</tt><tt class="py-op">*</tt><tt class="py-number">1.42903</tt><tt class="py-op">)</tt> </tt>
</div><a name="L75"></a><tt class="py-lineno">75</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1
    on Mon Apr 20 11:56:31 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
